<% layout('/layouts/default.html', {title: '供应链服务协议管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('供应链服务协议管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('agreement:supplyChainServiceAgreement:edit')){ %>
					<a href="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/form" class="btn btn-default btnTool" title="${text('新增供应链服务协议')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${supplyChainServiceAgreement}" action="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('协议编号')}：</label>
					<div class="control-inline">
						<#form:input path="supplyChainServiceAgreementCode" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('签订日期')}：</label>
					<div class="control-inline">
						<#form:input path="signDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="signDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="signDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="status1" dictType="erp_status" blankOption="true" class="form-control isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('甲方')}：</label>
					<div class="control-inline">
						<#form:treeselect id="company" title="${text('公司选择')}"
						path="company.companyCode" labelPath="company.companyName"
						url="${ctx}/sys/company/treeData" canSelectRoot="true" canSelectParent="true"
						class="" allowClear="true" callbackFuncName="companyCallback"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('乙方')}：</label>
					<div class="control-inline">
						<#form:treeselect id="customer" title="${text('乙方选择')}"
						path="customer.customerId" labelPath="customer.customerName"
						url="${ctx}/base/customer/customer/treeData" canSelectRoot="true" canSelectParent="true"
						class="" allowClear="true" callbackFuncName="customerCallback"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('丙方')}：</label>
					<div class="control-inline width-120">
						<#form:select path="guarantorId" items="${guarantorList}" itemLabel="guarantorName" itemValue="guarantorId" class="form-control" blankOption="true" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建者')}：</label>
					<div class="control-inline">
						<#form:input path="createBy" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建时间')}：</label>
					<div class="control-inline">
						<#form:input path="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="createDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("协议编号")}', name:'supplyChainServiceAgreementCode', index:'a.supply_chain_service_agreement_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/detail?supplyChainServiceAgreementId='+row.supplyChainServiceAgreementId+'" class="btnList" data-title="${text("编辑供应链服务协议")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("签订日期")}', name:'signDate', index:'a.sign_date', width:150, align:"center"},
		{header:'${text("签订地点")}', name:'signLocation', index:'a.sign_location', width:150, align:"left"},
		{header:'${text("状态")}', name:'status1', index:'a.status1', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('erp_status')}, val, '${text("未知")}', true);
		}},
		{header:'${text("开始日期")}', name:'startDate', index:'a.start_date', width:150, align:"center"},
		{header:'${text("结束日期")}', name:'endDate', index:'a.end_date', width:150, align:"center"},
		{header:'${text("甲方")}', name:'company.companyName', index:'u11.company_name', width:150, align:"center"},
		{header:'${text("乙方")}', name:'customer.customerName', index:'u12.customer_name', width:150, align:"center"},
		{header:'${text("丙方")}', name:'guarantor.guarantorName', index:'u13.guarantor_name', width:150, align:"center"},
		{header:'${text("创建者")}', name:'createBy', index:'a.create_by', width:150, align:"left"},
		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
		{header:'${text("操作")}', name:'actions', width:140, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
            <% if(hasPermi('agreement:supplyChainServiceAgreement:view')){ %>
                actions.push('<a href="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/detail?supplyChainServiceAgreementId='+row.supplyChainServiceAgreementId+'" class="btnList" title="${text("查看供应链服务协议")}"><i class="fa fa-file-text-o"></i></a>&nbsp;');
            <% } %>
			<% if(hasPermi('agreement:supplyChainServiceAgreement:edit')){ %>
				actions.push('<a href="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/form?supplyChainServiceAgreementId='+row.supplyChainServiceAgreementId+'" class="btnList" title="${text("编辑供应链服务协议")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/agreement/supplychainserviceagreement/supplyChainServiceAgreement/delete?supplyChainServiceAgreementId='+row.supplyChainServiceAgreementId+'" class="btnList" title="${text("删除供应链服务协议")}" data-confirm="${text("确认要删除该供应链服务协议吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>